<template>
  <div class="upload">
<!--    <el-upload-->
<!--      class="upload-demo"-->
<!--      ref="upload"-->
<!--      action="api/tle_upload/upload"-->
<!--      :on-preview="handlePreview"-->
<!--      :on-remove="handleRemove"-->
<!--      :file-list="fileList"-->
<!--      :auto-upload="false">-->
<!--      <el-button slot="trigger" size="small" type="primary">选取文件</el-button>-->
<!--      <el-button style="margin-left: 10px;" size="small" type="success" @click="submitUpload">上传到服务器</el-button>-->
<!--      <div slot="tip" class="el-upload__tip">只能上传jpg/png文件，且不超过500kb</div>-->
<!--    </el-upload>-->
    <el-upload
      id="tle_upload"
      class="tle_upload"
      ref="upload"
      drag
      width="500px"
      align="center"
      action="api/tle_upload/upload"
      :auto-upload="false"
      :file-list="fileList"
      accept=".txt"
    >
      <i class="el-icon-upload" style="width: 500px;"></i>
      <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
      <div class="el-upload__tip" slot="tip">只能上传txt文件，且不超过500kb</div>

    </el-upload>
    <div class="upload-submit" align="center">
      <el-button class="el-upload_button" style="margin-left: 10px;" size="small" type="success" @click="submitUpload">上传到服务器</el-button>
    </div>
  </div>
</template>

<script type="text/babel">

  export default {
    data() {
      return {
        fileList: []
      };
    },
    methods: {
      submitUpload() {
        this.$refs.upload.submit();
      },
      handleRemove(file, fileList) {
        console.log(file, fileList);
      },
      handlePreview(file) {
        console.log(file);
      }
    }
  }
</script>

<style lang="scss" type="text/scss" rel="stylesheet/scss" scoped>
  .upload{
    padding-top: 20px;
  }
  .upload-submit{
    padding-top: 20px;
  }


</style>
